<template>
  <div>
    <h1>进度条使用</h1>
    <Progress :percent="progress.progressNum"
              :stroke-width="20"
              text-inside />

  </div>
</template>
<script>
export default {
  data () {
    return {
      progress: {},
      timer: ''
    }
  },
  mounted () {
    this.timer = setInterval(() => { this.getProgress() }, 1000)
  },
  methods: {
    // 获取进度条
    getProgress () {
      if (this.progress.progressNum && this.progress.progressNum === '100.0') {
        clearInterval(this.timer)
      }
      console.log(1)
      this.$axios.get('/common/get/' + 'test').then(
        (res) => {
          this.progress = res.data
        }
      )
    }

  },
  beforeDestroy () {
    clearInterval(this.timer)
  }
}
</script>
